package messages

const OK = ""

const Success = "Success"
const InvalidParams = "InvalidParams"
const CheckAuthTokenFailError = "CheckAuthTokenFailError"
const CheckAuthTokenTimeoutError = "CheckAuthTokenTimeoutError"
const GenerateAuthTokenError = "GenerateAuthTokenError"
const AuthTokenError = "AuthTokenError"
const AuthFailError = "AuthFailError"
const ServerInternalError = "ServerInternalError"
const InvalidMessage = "InvalidMessage"

const NoIdleVehicle = "NoIdleVehicle"
const NoIdleVehicleInGroup = "NoIdleVehicleInGroup"
const NoSuchIdleVehicle = "NoSuchIdleVehicle"
const NoSuchBusyVehicle = "NoSuchBusyVehicle"
const NoSuchVehicle = "NoSuchVehicle"
const NoSuchVehicleInGroup = "NoSuchVehicleInGroup"
const VehicleNotExist = "VehicleNotExist"
const VehicleIsWorking = "VehicleIsWorking"
const VehicleIsPreChargingIdle = "VehicleIsPreChargingIdle"
const VehicleIsPreChargingWorking = "VehicleIsPreChargingWorking"
const VehicleIsCharging = "VehicleIsCharging"
const VehicleNotInCharging = "VehicleNotInCharging"
const VehicleIsLiftingUp = "VehicleIsLiftingUp"
const VehicleIsLoaded = "VehicleIsLoaded"
const VehicleIsBusinessWorking = "VehicleIsBusinessWorking"
const VehicleLowerPower = "VehicleLowerPower"
const VehicleLowerPowerAndNotLoaded = "VehicleLowerPowerAndNotLoaded"
const VehicleIsRebooting = "VehicleIsRebooting"
const VehicleNotReady = "VehicleNotReady"
const VehicleInFault = "VehicleInFault"
const VehicleIsOffline = "VehicleIsOffline"
const VehicleIsPhysicalError = "VehicleIsPhysicalError-Reboot"
const VehicleIsExecutingSegment = "VehicleIsExecutingSegment"
const VehicleNotInIdleList = "VehicleNotInIdleList"
const VehicleUnknownStatus = "VehicleUnknownStatus"
const VehicleLogoutFailure = "VehicleLogoutFailure"
const VehicleManualLock = "VehicleManualLock"
const VehicleNotManualLock = "VehicleNotManualLock"
const VehicleIpNotFound = "VehicleIpNotFound"
const VehicleRemoteCommandFailure = "VehicleRemoteCommandFailure"
const VehicleAlreadyHasRack = "VehicleAlreadyHasRack"
const VehicleWithoutTask = "VehicleWithoutTask"
const VehicleAlreadyAssignedOrBindedRack = "VehicleAlreadyAssignedOrBindedRack"
const VehicleNotAssignedInBusiness = "VehicleNotAssignedInBusiness"

const InvalidTask = "InvalidTask"
const InvalidParentTask = "InvalidParentTask"
const NoParentTask = "NoParentTask"
const TaskAlreadyExist = "TaskAlreadyExist"
const TaskCompleted = "TaskCompleted"
const TaskAborted = "TaskAborted"
const TaskCanceled = "TaskCanceled"
const TaskNotExist = "TaskNotExist"
const TaskExecuting = "TaskExecuting"
const VChargeAlreadyExist = "VChargeAlreadyExist"
const NoValidSubTask = "NoValidSubTask"
const TaskOrSubTaskAborted = "TaskOrSubTaskAborted"
const TaskCanNotCancel = "TaskCanNotCancel"
const TaskCanNotEdit = "TaskCanNotEdit"

const RackAlreadyBinded = "RackAlreadyBinded"
const RackAlreadyAssigned = "RackAlreadyAssigned"
const RackStartLocationIncorrect = "RackStartLocationIncorrect"
const RackNotExist = "RackNotExist"
const RackNotBinded = "RackNotBinded"

const NoPathFound = "NoPathFound"
const HasRackBlockedPath = "HasRackBlockedPath"

const InvalidStation = "InvalidStation"
const StationNotMatch = "StationNotMatch"
const VehicleNotArrivedStation = "VehicleNotArrivedStation"
const NoIdleDock = "NoIdleDock"
const NoIdleChargeDock = "NoIdleChargeDock"
const GetStationInfoError = "GetStationInfoError"

const UploadFileOverSize = "UploadFileOverSize"
const UploadFileError = "UploadFileError"
const UploadFileTypeError = "UploadFileTypeError"
const UploadFileSaveFileError = "UploadFileSaveFileError"
const UploadFileContentError = "UploadFileContentError"

const FileNotFound = "FileNotFound"

const InvalidLocation = "InvalidLocation"
const InvalidRack = "InvalidRack"
const InvalidVehicleGroup = "InvalidVehicleGroup"
const InvalidVehicle = "InvalidVehicle"
const InvalidStartLocation = "InvalidStartLocation"
const InvalidEndLocation = "InvalidEndLocation"

// 服务端定义的AGV异常
const AgvPhysicalError = "AgvPhysicalError"
const AgvOffline = "AgvOffline"

// 小车端定义的AGV异常
const AgvRackNumberMismatch = "AgvRackNumberMismatch"
const AgvLocationMarkMismatch = "AgvLocationMarkMismatch"
const AgvLowPower = "AgvLowPower"
const AgvInvalidTask = "AgvInvalidTask"
const AgvLocationMarkNotFound = "AgvLocationMarkNotFound"
const AgvLocationMarkCantResolve = "AgvLocationMarkCantResolve"
const AgvProhibitMotionByUser = "AgvProhibitMotionByUser"
const AgvProhibitMotionByAccident = "AgvProhibitMotionByAccident"
const AgvMotionOutOfControl = "AgvMotionOutOfControl"
const AgvNoRouteToTargetLocation = "AgvNoRouteToTargetLocation"
const AgvNonStandardLocation = "AgvNonStandardLocation"
const AgvStayToAvoidObstacle = "AgvStayToAvoidObstacle"
const AgvUnableToCharge = "AgvUnableToCharge"
const AgvPalletAngularOriginNotFound = "AgvPalletAngularOriginNotFound"
const AgvUnrecognizedMark = "AgvUnrecognizedMark"
const AgvUnrecognizedCommand = "AgvUnrecognizedCommand"
const AgvDuplicateCommand = "AgvDuplicateCommand"
const AgvUnableToMergeOrbit = "AgvUnableToMergeOrbit"
const AgvRackMarkNotFound = "AgvRackMarkNotFound"
const AgvRackMarkCantResolve = "AgvRackMarkCantResolve"
const AgvKinematicComponentFault = "AgvKinematicComponentFault"
const AgvMapUnreachable = "AgvMapUnreachable"
const AgvProhibitToTurnDirection = "AgvProhibitToTurnDirection"
const AgvRadarComponentFault = "AgvRadarComponentFault"
const AgvPeripheralComponentFault = "AgvPeripheralComponentFault"
const AgvImuComponentFault = "AgvImuComponentFault"
const AgvBmsComponentFault = "AgvBmsComponentFault"
const AgvUnableToLoad = "AgvUnableToLoad"
const AgvUnableToUnload = "AgvUnableToUnload"
const AgvTaskRunTimeout = "AgvTaskRunTimeout"
const AgvAvoidObstacleWhenTelescopic = "AgvAvoidObstacleWhenTelescopic"
const AgvMotorBlocked = "AgvMotorBlocked"
const AgvLoadStatusUnknown = "AgvLoadStatusUnknown"
const AgvUnexpectedRackDirection = "AgvUnexpectedRackDirection"
const AgvCustomError = "AgvCustomError"
const AgvPathConflict = "AgvPathConflict"

const SystemParameterNotAllowed = "SystemParameterNotAllowed"

const SystemRunning = "SystemRunning"

const NoVehicleIpConfigured = "NoVehicleIpConfigured"

const CancelVehicleCurMissionError = "CancelVehicleCurMissionError"
const TaskOrderBuildError = "TaskOrderBuildError"

const UnknownError = "UnknownError"
const AccessDenied = "AccessDenied" //wangyg 20201216增加授权拒绝访问
const RecordNotFound = "RecordNotFound"

var MsgFlags = map[string]string{
	OK: "OK",

	Success:                    "",
	InvalidParams:              "请求参数错误",
	CheckAuthTokenFailError:    "Token鉴权失败",
	CheckAuthTokenTimeoutError: "Token已超时",
	GenerateAuthTokenError:     "Token生成失败",
	AuthTokenError:             "Token错误",
	AuthFailError:              "用户验证失败",
	ServerInternalError:        "服务器内部错误",
	InvalidMessage:             "无效的消息",

	UnknownError: "未知错误",

	AccessDenied:   "您无权访问，请与管理员联系",
	RecordNotFound: "记录未找到，可能己被删除",
}

func GetMsg(code string) string {
	msg, ok := MsgFlags[code]
	if ok {
		return msg
	}

	return MsgFlags[ServerInternalError]
}
